package com.weasel.security.escape.filter;

import com.weasel.security.escape.XssHttpServletRequestWrapper;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * Created by Dylan on 2015/12/16.
 */
public class XssFilter extends AbstractScurityFilter{


    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        doFilterInternal(new XssHttpServletRequestWrapper((HttpServletRequest)request),response,chain);
    }

    protected void doFilterInternal(HttpServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException {
        chainFilter(request,response,chain);
    }

    private void chainFilter(HttpServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException {
        chain.doFilter(request,response);
    }
}
